package com.lez.kotlincoroutine.repositroy

import com.lez.kotlincoroutine.api.Banner
import com.lez.kotlincoroutine.api.userServiceApi

class BannerRepositroy {

    //在Resoositroy中方法要定义为suspend的挂起函数
    suspend fun loadBanners() : Banner {
        var responseBanner = userServiceApi.getBanner()
        if(responseBanner!=null && responseBanner.data.size > 0){
            return responseBanner.data[0]
        }
        return Banner(100,"----","未获取到数据","----")
    }

}